{% extends "../basepage.html" %}
{% block js %}
<!--xieyingan加的代码-->
<script language="javascript">
///通过单击行反选该行所有CheckBox
function SelectTR(tr)
{
  var tds=tr.childNodes;
  for(var j=0; j<tds.length;j++)
  {
	var inputs=tds[j].childNodes;
	for (var i=0; i < inputs.length; i++) // 遍历页面上所有的 input
    {
	  if (inputs[i].type == "radio")
		{
		  inputs[i].checked = !inputs[i].checked;
		  //tr.style.backgroundColor = inputs[i].checked ? "#245EDC" : ""; //改变选中行的背景色
	  }
	}
  }
}
</script>
<script for = btnNext event=onclick>////下一层
   var value="";
   var maincode="";
   var subscribeType="";
   if(!subtype.length){
    	value=value+box.value; //值的拼凑 .. 具体处理看你的需要
		maincode=maincode+main.value;
		subscribeType=subscribeType+subtype.value;
   }
   for (var i=0;i<subtype.length;i++ ){
     if(subtype[i].checked){ //判断复选框是否选中
    	value=value+box[i].value; //值的拼凑 .. 具体处理看你的需要
		maincode=maincode+main[i].value;
		subscribeType=subscribeType+subtype[i].value;
	 }
   }
   if(subscribeType==null||subscribeType==""){
   	alert("请选择一条数据进行操作");
   }else{
   window.location.href="/subscribeOtherList?userName="+value+"&maincode="+maincode+"&level=1&subscribeType="+subscribeType;
   }
</script>
<script for = btnDel event=onclick>////删除
   var value="";
   var maincode="";
   if(!subtype.length){
    	value=value+box.value; //值的拼凑 .. 具体处理看你的需要
		maincode=maincode+main.value;
   }
   for (var i=0;i<subtype.length;i++ ){
     if(subtype[i].checked){ //判断复选框是否选中
    	value=value+box[i].value; //值的拼凑 .. 具体处理看你的需要
		maincode=maincode+main[i].value;
	 }
   }
   if(value==null||value==""){
   	alert("请选择一条数据进行操作");
   }else{
	if(window.confirm("你确认要删除吗？"))
   	window.location.href="/subscribeDelete?userName="+value+"&maincode="+maincode;
   }
</script>
<script language="javascript"><!-- 改变单元格背景色 -->
 function cells_color(){
	var oColor,td=event.srcElement
	 if(td.tagName!="TD")
	   return ;
	if(event.type=="mouseover"){
		oColor="#C5D7EF";
		}
		
	 else{ 
	 	oColor="#ffffff"
	 }
	 tr=td.parentElement
	 for(var i=0;i<tr.cells.length;i++)
		 tr.cells[i].bgColor=oColor
 }

</script>
<!--xieyingan加的代码END-->
 <script type="text/javascript" language="javascript">
    for (i=0;i<TableNew.rows.length;i++) 
    {
        if(i%2==0)
        {
            TableNew.rows(i).className = "a1";
        }
        else
        {
            TableNew.rows(i).className = "";
        }
　　}
</script>
<style type="text/css">
.STYLE1 {
	height:25px;
	background-color:#ffffff;
}
</style>
{% endblock %}
{% block body %}
<body    style="background:#ececec">
{% endblock %}
{% block navigator %}
<a  href="/contentList/0">资讯内容管理</a> 
 >> <a href="#">用户订阅信息</a>  >> <a href="javascript:history.back(-1);">后退</a>
{% endblock %}
{% block content %}
<!--<a href="/subscribeOtherAdd?userName={{subscribe.userName}}&maincode={{subscribe.maincode}}">另外订阅</a>-->
<form  method="post" action="/subscribeInfo">
<table align="center" width="90%" border="0"  cellpadding="0" cellspacing="0" >
  <tr align="center">
    <td>用户名:
	<input  name="searchType" type="text" value="{{searchType}}"/>
    <input type="submit" name="search" value="搜索"/>
	</td>
  </tr>
</table>
</form>
<table id="TableNew" border="0" width="90%" cellpadding=1 cellspacing=1 bgcolor="#D5E3E6"  onMouseOver="cells_color();" onMouseOut="cells_color();" >
	<tr class="STYLE1">
		<td align="right" colspan="8">
{%if searchType%}
<input type="button" value="添加订阅" onclick="javascript:window.location.href='userSubscribeAdd?userName={{searchType}}&father='"/>
{%endif%}
<input type="button" name="btnDel" value="删 除"/>	</td>
	</tr>
	<tr class="STYLE1">
		<td align="center" width="70px"><a href="/subscribeList?searchType=userName">用户</a></td>
        <td align="center" width="70px">资讯编号</td>
		<td align="center" width="70px">订阅类型</td>
		<td align="center" width="90px">订阅改变时间</td>
		<td align="center" width="70px">订阅状态</td>
		<td align="center" width="70px">订阅操作</td>
		<td align="center" width="30px"></td>
	</tr>
	{% for subscribe in subscribes%}
    <tr class="STYLE1" style="cursor:hand" onClick="SelectTR(this)" >
		<td align="center">{{subscribe.userName}}</td>
        <td align="center">
        {%ifequal subscribe.subscribeType '0'%}
        {{subscribe.maincode}}
        {%else%}
        <a href="/subscribeOtherList?userName={{subscribe.userName}}&father={{subscribe.maincode}}&level=1&subscribeType={{subscribe.subscribeType}}">{{subscribe.maincode}}</a>
        {%endifequal%}
        </td>
        {%ifequal subscribe.subscribeType '0'%}
		<td align="center">全要</td>
		{%else%}
		<td align="center">只要本层</td>
		{%endifequal%}
		<td align="center">{{subscribe.lastUpdateTime|date:"Y-m-d H:i:s"}}</td>
		{%ifequal subscribe.status '1'%}
		<td align="center">订阅</td>
		<td align="center"><a href="/subscribeStatus?userName={{subscribe.userName}}&maincode={{subscribe.maincode}}">取消</a></td>
		{%else%}
		<td align="center">已取消</td>
		<td align="center"><a href="/subscribeStatus?userName={{subscribe.userName}}&maincode={{subscribe.maincode}}">订阅</a></td>
		{%endifequal%}
        <td align="center">
          <input name="radio" style="visibility:hidden; display:none" type="radio" id="box" value="{{subscribe.userName}}" >
		  <input name="radio" style="visibility:hidden; display:none" type="radio" id="main" value="{{subscribe.maincode}}" >
		  <input name="radio"  type="radio" id="subtype" value="{{subscribe.subscribeType}}" ></td>
	</tr>
	{%endfor%}
</table>
{% endblock %}